package academic.emailClient.control.listeners;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.UUID;

import academic.emailClient.control.FolderViewMapper;
import academic.emailClient.model.EmailClientModel;
import academic.emailClient.view.EmailClientViewInterface;

public class MoveToSubfolderActionListener implements ActionListener{
	private EmailClientModel model;
	private EmailClientViewInterface view;
	
	/**
	 * Constructor
	 * @param model
	 * @param view
	 */
	public MoveToSubfolderActionListener(EmailClientModel model,
			EmailClientViewInterface view) {
		super();
		this.model = model;
		this.view = view;
	}

	
	/**
	 * Move To Sub folder Action Event
	 */
	@Override
	public void actionPerformed(ActionEvent e) {
		String destination = e.getActionCommand();
		String source = view.getSelectedFolderPath();
		ArrayList<UUID> messages = view.getSelectedMessages();
		model.moveMessagesToSubfolders(source, destination, messages);
		view.deleteSelectedMessages();
		
	}

}
